<template>
  <div>
    <div v-if="store.cur_user">
            用户: {{store.cur_user?.nickName}}<span @click="logout()">【注销】</span>
    </div>
    <div v-else>
            <router-link to="/login">请登录</router-link>
    </div>
  </div>
</template>

<script setup>
  import { ref, computed } from "vue";
  import { userStore } from "../store/UserStore";
  const store = userStore();
  import { useRouter } from "vue-router";
  const router = useRouter();
  function logout(){
        store.clearUser();
        router.push("/login");
  }
//   let info=computed(function(){
//      return store.cur_user?store.cur_user.nickName:"未登录"
//     });
//   let isLogin=computed(function(){
//      return store.cur_user?true:false
//     });

</script>

<style>

</style>